/*-------------------------------------------------------------------------

***************** Modification History ***********************************
   @doc
   @module report.h - Header file for application report functions |
   @end
   
$Log: /SoftPay/SPK2SIM/Source/Include/report.h $ 
**************************************************************************
 
   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.

---------------------------------------------------------------------------*/


#ifndef VSREPORT_DEFINED
#define VSREPORT_DEFINED

#include <udt.h>

#include <transact.h>
#include <print.h>
#include <sizes.h>
#include <list.h>

/*
 *  Following must be set
 *  for a given host...
 *  Need to be analyzed and set properly for NCR
 */
#define HOST_NETID    'V'
#define HOST_NETID_TEST  ((HOST_NETID+1) != (HOST_NETID))

typedef struct
{
    int     inSaleCnt;
    int     inTipCnt;
    int     inRefCnt;
    int     inCBackCnt;
    int     inGrandCnt;
    int     inSurchgCnt;
    int     inTaxCnt;
    int     inVoidCnt;
 	/*  change for large Amounts.
 	long    lnSaleAmt;
    long    lnTipAmt;
    long    lnRefAmt;
    long    lnCBAmt;
    long    lnGrandAmt;
    long    lnSurCharge;
    long    lnTaxAmt;   */
    
    double 	dbSaleAmt;
    double 	dbTipAmt;
    double 	dbRefAmt;
    double 	dbCBAmt;
    double 	dbGrandAmt;
    double 	dbSurCharge;
    double 	dbTaxAmt;  
    
} DETAIL_TOTALS;

typedef struct
{
    int  inTotalCnt;
    /*
    long lnTotalAmt;
    long lnSaleAmt;
    long lnTipAmt;
    long lnTaxAmt;
    long lnCashBack;
    long lnSurCharge;*/

	double 	dbTotalAmt; 
    double 	dbSaleAmt;
    double 	dbTipAmt;
    double 	dbTaxAmt;
    double 	dbCashBack;
    double 	dbSurCharge;
     
} CARD_TOTS_REC;

#define SIZE_CARD_TOTS_REC     (int)sizeof(CARD_TOTS_REC)

extern char **TablesForQAReportList;

// REPORT.C

void vdSetReportHeaderCondition (TRANSACTION_OBJECT *pobTran);
void vdSetSettleReportCondition (VS_BOOL fBatchRpt, VS_BOOL fSettleSucceeded);
int inPrintReportHeader (TRANSACTION_OBJECT *pobTran, PRINTER_OBJECT *obPrinter);
void vdSetTranStatus(TRANSACTION_OBJECT *pobTran);
void vdSetReportDateAndTime(void);
void vdLoadDateTime(TRANSACTION_OBJECT *pobTran);
int inMakeTerminalTotals (TRANSACTION_OBJECT *pobTran, VS_BOOL fBack, VS_BOOL fSettleSucceeded);
void vdMakeReportHeader (TRANSACTION_OBJECT *pobTran);
int inQADebugReportOperation (TRANSACTION_OBJECT *pobTran);
int inCheckMultiCurrency (TRANSACTION_OBJECT *pobTran);
int REPORT_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);

// REPORT1.C

void vdMakeDetailMiddle (TRANSACTION_OBJECT *pobTran, DETAIL_TOTALS *psrDetTot);
int inDetailReportOperation (TRANSACTION_OBJECT *pobTran);
int inReprintAnyReceiptOperation (TRANSACTION_OBJECT *pobTran);
int inReprintLastReceiptOperation (TRANSACTION_OBJECT *pobTran);
void vdSetDetailMiddleCondition (TRANSACTION_OBJECT *pobTran);
void vdSetDetailBottomCondition (TRANSACTION_OBJECT *pobTran, int inPrintDetail, int inNumberOfRecordsinBatch, int inGrandTotal, DETAIL_TOTALS *psrDetTot);
int inAccumDetailTotals (DETAIL_TOTALS *psrAccumTot, DETAIL_TOTALS *psrDetTot);
int inZeroDetailTotals (DETAIL_TOTALS *psrDetTot);
int inSetDetailPrintTotals (DETAIL_TOTALS *psrDetTot);
int inOpenTabReportOperation (TRANSACTION_OBJECT *pobTran);

// REPORT2.C

void vdSetHostCaptureReportCondition (TRANSACTION_OBJECT *pobTran, VS_BOOL fCreditHost, VS_BOOL fDebitHost);
int inPrintHostCaptureReport (VS_BOOL fCreditHost, VS_BOOL fDebitHost, VS_BOOL fCommErr, PRINTER_OBJECT *obPrinter, TRANSACTION_OBJECT *pobTran);
int inPrintReptHeader (TRANSACTION_OBJECT *pobTran, PRINTER_OBJECT *obPrinter);
int inUnadjustedOperation (TRANSACTION_OBJECT *pobTran);
int inPrintUnadjReport (PRINTER_OBJECT *obPrinter, TRANSACTION_OBJECT *pobTran);
void vdSetUnadjustHeaderCondition (int inReportTop, int inNewClerk);
void vdSetUnadjustBottomCondition (int inCount);
void vdMakeUnadjMiddle (TRANSACTION_OBJECT *pobTran);
int REPORT2_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);

// REPORT3.c

VS_BOOL fGetPrintRecs (PRINTER_OBJECT *pobPrinter);
int inPrintMerchTables (char *pchDataFileName, char *pchCharName, VS_BOOL fTempFile);
int inCreateFieldPrintList(RecordList *prlRecordList, RecordNode *pndRecordNode, 
						   VS_BOOL *(*pfnFieldValidator)(), FieldList  **ppflFieldList);
int inPrintRecord(PRINTER_OBJECT *pobPrinter, RecordList *prlRecordList, Node *pndSelectedRecord);
int inConfPrintRecs (PRINTER_OBJECT *pobPrinter, char *pchDataFileName, char *pchPrintFileName);
void vdPrintFieldNode(PRINTER_OBJECT *pobPrinter, FieldList *pflFieldList, FieldNode *pndFieldNode);
int inSelectPrintNode (PRINTER_OBJECT *pobPrinter, List *pliListOfChoices, Node **ppndSelectedNode, RecordList *prlRecordList);
int inGetHostTRTFile(PRINTER_OBJECT *pobPrinter);
int inTRTPrintRecs (PRINTER_OBJECT *pobPrinter, char *pchDataFileName);
int inPrintTRTRecord(PRINTER_OBJECT *pobPrinter, RecordList *prlRecordList, Node *pndSelectedRecord);
int inSelectTRTPrintNode (PRINTER_OBJECT *pobPrinter, List *pliListOfChoices, Node **ppndSelectedNode, RecordList *prlRecordList);
void vdPrintTRTFieldNode(PRINTER_OBJECT *pobPrinter, FieldList *pflFieldList, FieldNode *pndFieldNode, 
    char *pszTableValue, int *pinParamLines, int *pinParamFields);
int inCheckBannedCardType(TRANSACTION_OBJECT *pobTran);
void vdGetSQAFieldNodeValue(RecordList *prlRecordList, int inFieldIndex, char *szFieldValue);
int inGetHostHFTFile(PRINTER_OBJECT *pobPrinter);
int inHFTPrintRecs (PRINTER_OBJECT *pobPrinter, char *pchDataFileName);
int inPrintHFTRecord(PRINTER_OBJECT *pobPrinter, RecordList *prlRecordList, Node *pndSelectedRecord);
int inSelectHFTPrintNode (PRINTER_OBJECT *pobPrinter, List *pliListOfChoices, Node **ppndSelectedNode, RecordList *prlRecordList);
void vdPrintHFTFieldNode(PRINTER_OBJECT *pobPrinter, FieldList *pflFieldList, FieldNode *pndFieldNode, 
    char *pszTableValue, int *pinParamLines, int *pinParamFields);

#endif		/* VSREPORT_DEFINED */


